package main

import (
	"fmt"
	_ "fmt"
)

/*
让我解释一下 Go 语言中常用的格式化符号：
	%s - 用于输出字符串
	%d - 用于输出整数
	%f - 用于输出浮点数
	%v - 用于输出任何类型的值（通用格式）
	%T - 用于输出值的类型
	%t - 用于输出布尔值
	%c - 用于输出字符
	%p - 用于输出指针地址
*/

func main() {

	//声明一个变量，默认值为0
	var a int
	fmt.Println(a)

	// :=声明一个变量，只能用于函数体内部，不能声明全局变量
	b := 100
	fmt.Println(b)
	fmt.Printf("type of b = %T\n", b)

	//声明一个变量，初始化值
	var c = 100
	fmt.Println(c)
	fmt.Printf("type of c = %T\n", c)

	var d = "go is good"
	fmt.Println(d)
	fmt.Printf("type of d = %T\n", d)

	var e string = "go is good"
	fmt.Println(e)
	fmt.Printf("type of e = %T", e)

	var f float32 = 3.24
	fmt.Println(f)
	fmt.Printf("type of f = %T\n", f)

	var g = 3.2498
	fmt.Println(g)
	fmt.Printf("type of g = %T\n", g)

	//多变量声明
	var h, i = 100, 500
	fmt.Println(h, i)
	fmt.Printf("type of h = %T\n", h)
	fmt.Printf("type of i = %T\n", i)

	var j, k = 100, "500"
	fmt.Println(j, k)
	fmt.Printf("type of j = %T\n", j)
	fmt.Printf("type of k = %T\n", k)

	var c1 byte = 'a'
	fmt.Printf("c1 = %c\n", c1)
	fmt.Println("c1 =", c1)

	var c2 byte = '1'
	fmt.Println("c2 =", c2)
}
